package com.ric.springredis.controller;

import com.ric.springredis.entity.RoleEntity;
import com.ric.springredis.service.RoleService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

/**
 * 创建 JYQ  on  2018/10/30,10:40
 */
@RestController
@RequestMapping("/role")
public class RoleController {
    @Resource
    private RoleService service;


    @RequestMapping("/findAll")
    public List<RoleEntity> findAll() {
        return this.service.findAll();
    }


    @RequestMapping("/findOne/{roleId}")
    public RoleEntity findOne(@PathVariable Long roleId) {
        return this.service.findOne(roleId);
    }


    @RequestMapping("/save")
    public Boolean save(RoleEntity roleEntity) {
      this.service.save(roleEntity);
        return true;
    }

    @RequestMapping("/delete/{roleId}")
    public Boolean delete(@PathVariable Long roleId) {
        Boolean delete = this.service.delete(roleId);
        return true;
    }
    @RequestMapping("/like/{roleId}")
    public  boolean like(@PathVariable Long roleId){
        this.service.thumb(roleId);
        return true;
    }
    @RequestMapping("/thumbList")
    public Set<?> thumbList(){
        Set<?> set = this.service.thumbList();
        return  set;
    }


}
